﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="油管销售日报表.aspx.cs" Inherits="syc.Sale.Report.油管销售日报表" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <script type="text/javascript" language="javascript" src="/common.js"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
            <div class="hooo">
        <div id="wintop" class="wintop"><span lang="zh-cn"><u>销售日报表</u></span></div>
        <asp:Panel ID="Panel1" runat="server" CssClass="panel" Height="36px" Width="972px">
  
        <table>
        <tr id="row4" runat="server">
        <td>
        日期：
        </td>
        <td>
         <asp:TextBox ID="RiQi" runat="server" CssClass="intxt1" Width="110px" 
                ontextchanged="RiQi_TextChanged"></asp:TextBox>
         <img alt=""  src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('RiQi').value, document.getElementById('RiQi'));" />
         </td>
         <td>            
         
         <asp:Button ID="Button_New" runat="server" Text="生成报表" CssClass="button" 
                UseSubmitBehavior="False" onclick="Button_New_Click"/>
         
         </td>
        </tr>
        </table>
        </asp:Panel>
        <asp:Panel ID="Panel2" runat="server" CssClass="panel2" Width="962px">
        <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt" Visible="True"></asp:Label>
        </asp:Panel> 
    
        <h1 style="text-align: center;">
            销售日报表</h1>

        <div align="center"> 
       <asp:Label ID="Label1" runat="server" Text="Label" style="text-align: right;">填报日期:<%= date.ToShortDateString() %></asp:Label>   
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource1" style="text-align: center" BorderColor="Black" 
                BorderStyle="Solid" BorderWidth="2px" OnRowCreated="GridView1_RowCreated">
                 <RowStyle Height="40px" />
                 <HeaderStyle Height="40px" />                
            <Columns>


                <asp:BoundField DataField="接货单位" HeaderText="接货单位" 
                    SortExpression="接货单位" />
                <asp:BoundField DataField="品名" HeaderText="品名" 
                    SortExpression="品名" />
                <asp:BoundField DataField="当日车数" HeaderText="当日车数" SortExpression="当日车数" 
                    ReadOnly="True" />
                <asp:BoundField DataField="当日支数" HeaderText="当日支数" SortExpression="当日支数" 
                    ReadOnly="True" />
                <asp:BoundField DataField="当日重量" HeaderText="当日重量" SortExpression="当日重量" 
                    ReadOnly="True" />
                <asp:BoundField DataField="月车数" HeaderText="月车数" 
                    SortExpression="月车数" ReadOnly="True" />
                <asp:BoundField DataField="月支数" HeaderText="月支数" 
                    SortExpression="月支数" ReadOnly="True" />
                <asp:BoundField DataField="月重量" HeaderText="月重量" 
                    SortExpression="月重量" ReadOnly="True" />
                <asp:BoundField DataField="年车数" HeaderText="年车数" 
                    SortExpression="年车数" ReadOnly="True" />
                <asp:BoundField DataField="年支数" HeaderText="年支数" 
                    SortExpression="年支数" ReadOnly="True" />
                <asp:BoundField DataField="年重量" HeaderText="年重量" ReadOnly="True" 
                    SortExpression="年重量" />
            </Columns>
        </asp:GridView>
        </div>
    
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
            SelectCommand="SELECT 
dbo.产品订货单位.名称 AS 接货单位,
dbo.产品.品名, 
COUNT(*) AS 当日车数,
SUM(c.总支数) AS 当日支数, 
SUM(c.总重量) AS 当日重量, 
	(SELECT COUNT(*) AS Expr1
	FROM dbo.产品出库单
	WHERE  (MONTH(日期)= 12) AND 
		   (YEAR(日期) = 2009) AND
		   产品类别ID=c.产品类别ID
		   ) 
		   AS 月车数,
	(SELECT SUM(总支数) AS Expr1
	FROM dbo.产品出库单
	WHERE  (MONTH(日期)= 12) AND 
		   (YEAR(日期) = 2009) AND
		   产品类别ID=c.产品类别ID
		   ) 
		   AS 月支数,
	(SELECT SUM(总重量) AS Expr1
	FROM dbo.产品出库单
	WHERE  (MONTH(日期)= 12) AND 
		   (YEAR(日期) = 2009) AND
		   产品类别ID=c.产品类别ID
		   ) 
		   AS 月重量,
	(SELECT COUNT(*) AS Expr1
	FROM dbo.产品出库单
	WHERE  (YEAR(日期) = 2009) AND
		   产品类别ID=c.产品类别ID
		   ) 
		   AS 年车数,
	(SELECT SUM(总支数) AS Expr1
	FROM dbo.产品出库单
	WHERE  (YEAR(日期) = 2009) AND
		   产品类别ID=c.产品类别ID
		   ) 
		   AS 年支数,
	(SELECT SUM(总重量) AS Expr1
	FROM dbo.产品出库单
	WHERE  (YEAR(日期) = 2009) AND
		   产品类别ID=c.产品类别ID
		   ) 
		   AS 年重量
FROM         
dbo.产品 INNER JOIN
dbo.产品出库单 AS c ON dbo.产品.ID = c.产品类别ID INNER JOIN
dbo.产品销售合同 ON c.合同ID = dbo.产品销售合同.ID INNER JOIN
dbo.产品订货单位 ON dbo.产品销售合同.订货单位ID = dbo.产品订货单位.ID
WHERE
c.日期='2009-12-05'
GROUP BY
dbo.产品订货单位.名称,
dbo.产品.品名,
c.产品类别ID"></asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
